package sctu.edu.java.year2016.team08.lisonghong.day20160522.chapter6_1;

/**
 * 编写程序。判读字符串出现了几次i；
 * Created by 松红 on 2016/5/22.
 */
public class chapter6_1 {
    public static void main(String[] args) {
        int count = 0;
        String s = new String("mingrikejijavabu");
        char[] charArray = s.toCharArray();
        for (int i = 0; i < s.length(); i++) {
            if (charArray[i] == charArray[1]) {
                count++;
            }
        }

        System.out.println("i一共出现了" + count + "次");

    }
}
